<template>
    <div class="loanKind">
        <group v-for="(item,index) in loantype" :key="index">
            <cell :title="item.prdnam" :link="{path:nextPath,query:{lonnbr:item.lonnbr}}" is-link>
                <slot>余额：{{item.bal|filterMoney}}元</slot>
            </cell>
        </group>
        <div class="telphone">
            对余额有疑问，点击致电95555
        </div>
    </div>
</template>

<script>
import { Group, Cell, numberComma } from "vux";
import api from "../fetch/api";
import { getStore, setStore, removeStore } from "../config/mUtils";
export default {
  components: {
    Group,
    Cell
  },
  data() {
    return {
      loantype: [], //贷款分类
      nextPath: "" // 即将跳转的path
    };
  },
  filters: {
    filterMoney(value) {
      let newValue = numberComma(value);
      return newValue;
    }
  },
  activated() {
    if (this.$route.query.type === "repay") {
        this.nextPath = '/chose/loanway'
    } else if (this.$route.query.type === "change") {
        this.nextPath = '/change'
    } else if (this.$route.query.type === "get") {
        this.nextPath = '/get'
    }
    api.get_loan_way({ token: getStore("token") }).then(res => {
      if (res.success) {
        this.loantype = res.loantype;
      }
    });
  }
};
</script>

<style lang="less" scoped>
.loanKind {
  .weui-cells {
    margin-top: 0.5rem;
  }
}
</style>

